package com.edu.scau.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="sold")
public class Sold implements Serializable {
	@Id
	@ManyToOne(targetEntity = OrderForm.class)
	@Cascade(value = CascadeType.ALL)
	@JoinColumn(name = "order_form_id", referencedColumnName="order_form_id")
	private OrderForm orderForm;
	
	@Id
	@ManyToOne(targetEntity = Commodity.class)
	@Cascade(value = CascadeType.ALL)
	@JoinColumn(name = "commodity_id", referencedColumnName="commodity_id")
	private Commodity commodity;
	
	@Column(name = "number")
	private Integer number;
	
	public Sold() {
		// TODO Auto-generated constructor stub
	}

	public OrderForm getOrderForm() {
		return orderForm;
	}

	public void setOrderForm(OrderForm orderForm) {
		this.orderForm = orderForm;
	}

	public Commodity getCommodity() {
		return commodity;
	}

	public void setCommodity(Commodity commodity) {
		this.commodity = commodity;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}
	
	
	
}
